Repository navigation
Conversation
Reading a closing edge from its shorter end (#228) leaves one case: both ends are hubs, so either list is long and every row still scans one. The shape suite's triangle through a hub at both ends grew 23x (memory) from degree 10 to 100,000. When the list a closing edge would read is longer than 256 entries, the second row in a batch that reads the same list builds an index of its neighbours to their edge rows, and later rows answer with one lookup. The first sighting still scans, so a list that comes up once costs no more than before. A row decides at its start, so a paused row resumes as it began, and the index path keeps the scan's work budget. Only the closing-edge copy of the loop changes. Both thresholds explain their values in their doc comments.
Deploying lance-csr with
|
| Latest commit: |
2501264
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0ae1266a.lance-csr.pages.dev |
| Branch Preview URL: | https://perf-closing-edge-hub-index.lance-csr.pages.dev |
7 of 16 tasks
prrao87
marked this pull request as ready for review
November 28, 2026 15:36
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #223.
Why
#228 made a closing edge (the last hop of a cycle, whose target is already bound) read the shorter of its two ends' lists. That fixed a hub at one end, but not a hub at both: if the source has 100,000 outgoing edges and the target 100,000 incoming ones, the shorter list is still 100,000 long, and every row scans it. In the shape suite, a triangle through a hub at both ends got 24 times slower in memory mode (16 times in lazy mode) as the hubs' degree rose from 10 to 100,000.
What changed
The shape suite's both-ends headline drops from 24× to 4.1× (memory) and from 16× to 3.2× (lazy), but not to 1. Each row now costs the same at any degree; what remains is a one-time cost per batch, one scan of the hub's list and one index build. Removing that would mean precomputing hub indexes when the CSR is built, which is a bigger change, so I've left the #223 item "A closing edge costs the same whatever the degree of its endpoints" unchecked.
Validation
cargo test --workspace,cargo clippy --workspace --all-targets -- -D warnings,make test(1,822 passed), the strict docs build andtypospass locally. A new unit test runs five closing-edge rows between two hubs (with a parallel edge, another target and a missing one) and checks that the index gives exactly the scan's rows and edge rows, including with one row per batch so a row's indexed edges resume after a pause. CI has not run yet.CONTRIBUTING.md: release wheels frommain(a480fd5) and this branch (2501264), alternatingmainand branch twice each,memoryandlazy. Every answer check and every shape-suite phrasing and plan check passed.Shape suite headlines (
smallgraph):Only the both-ends queries moved by 15% or more: degree 10,000 by −61% (memory) and −52% (lazy), and degree 100,000 by −82% and −80%. At degree 100,000 the index adds about 3 MiB of peak memory in memory mode and 6 MiB in lazy mode.
SF1 suites:
mainmainrun 2 / run 1No SF1 query moved by 10% or more.
Machine: Apple M5 MacBook Pro, 24 GB, macOS 26.6.2. Load average 1.7 to 8.8, with the high end right after the release builds; another terminal app was also running.
Every SF1 query
graph-benchmark, memory
Geomean branch/main: 1.001; main run 2 / run 1: 0.992 (largest single-query main gap 5%)
graph-benchmark-ldbc, memory
Geomean branch/main: 1.000; main run 2 / run 1: 1.004 (largest single-query main gap 22%)
graph-benchmark-ldbc, lazy
Geomean branch/main: 0.991; main run 2 / run 1: 0.981 (largest single-query main gap 9%)
graph-benchmark-ldbc-complex, memory
Geomean branch/main: 1.003; main run 2 / run 1: 1.021 (largest single-query main gap 4%)
graph-benchmark-ldbc-complex, lazy
Geomean branch/main: 1.000; main run 2 / run 1: 0.993 (largest single-query main gap 3%)
Every shape-suite query
memory: small graph (20,000 accounts, 229,517 T edges, hub degrees [10, 1000, 10000, 100000])
Runs: main x2, branch x2.
main run-to-run geomean: 1.000; largest single-query gap 9%.
lazy: small graph (20,000 accounts, 229,517 T edges, hub degrees [10, 1000, 10000, 100000])
Runs: main x2, branch x2.
main run-to-run geomean: 0.995; largest single-query gap 10%.
🤖 Generated with Claude Code